package com.dev.print.utils;

import android.os.Build;

import java.lang.reflect.Method;

/**
 * Created by Administrator on 2015/11/3.
 */
public class DecideTools {

    public static String getprop(String paramString1, String paramString2) {
        String str = paramString2;
        try {
            Class localClass = Class.forName("android.os.SystemProperties");
            Class[] arrayOfClass = new Class[2];
            arrayOfClass[0] = String.class;
            arrayOfClass[1] = String.class;
            Method localMethod = localClass.getMethod("get", arrayOfClass);
            Object[] arrayOfObject = new Object[2];
            arrayOfObject[0] = paramString1;
            arrayOfObject[1] = "unknown";
            str = (String) localMethod.invoke(localClass, arrayOfObject);
            LogUtils.d("get property, " + paramString1 + " = " + str);
        } catch (Exception localException) {
            LogUtils.d("get property error, " + localException.getMessage());
        }

        return str;
    }

    public static boolean isGuoHui() {
        boolean result = false;
        String device = Build.DEVICE;
        String model = Build.MODEL;
        if (getprop("ro.product.factory", "unknown").equalsIgnoreCase("SMDT"))
            return true;
        if(device.toLowerCase().indexOf("-mbox") > 0 ||
                device.toLowerCase().indexOf("-lbox") > 0 ||
                model.equalsIgnoreCase("SoftwinerEvb") || model.equalsIgnoreCase("Allwinner")){
            //TODO:device="fiber-a31st"		//A31S
            result = true;
        }
        // 判断睿翼板卡定时开关机;
        if (device.equalsIgnoreCase("sugar-yrx") || device.equalsIgnoreCase("mars-yrx")
                || device.equalsIgnoreCase("sugar-adtv") || device.equalsIgnoreCase("mars-adtv")
                || device.equalsIgnoreCase("56iqDS")) {
            result = false;
        }
        return result;
    }
}
